-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Demonstrate GPIO interrupts on the LPC55S69-EVK board. #1919
base: master
Are you sure you want to change the base?
Conversation
task/button/src/main.rs
Outdated
}; | ||
|
||
// XXX for now at least, setting up a PINT pin will set dir to Input | ||
server.gpio.disable_rising(BUTTON_PINT_MASK); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of these calls are redundant with the reset state of the PINT peripheral and can be removed.
Note: This implementation only implements edge-detection interrupts and ignores level-detection. |
8b12ea1
to
6dd78e5
Compare
fn set_pin_direction(&self, port: usize, pin: usize, dir: Direction) { | ||
match dir { | ||
Direction::Input => self.gpio.dirclr[port] | ||
.write(|w| unsafe { w.dirclrp().bits(1 << pin) }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The unsafe is a quirk of how the lpc55-pac is generated. Adding a safety comment for this is unlikely to be useful.
2ae073d
to
1e52c42
Compare
Add interrupt-related API calls to the LPC55 `gpio_driver`. A task on an LPC55 can now configue and use GPIO interrupts. app.toml example shows Pin Interrupt configuration: [tasks.foo] ... interrupts = { "pint.irq0" = "button-irq" } ... task-slots = ["gpio_driver", ...] [tasks.foo.config] pins = [ { name="BUTTON', pin={ port=1, pin=9}, alt=0, pint=0, direction="input", opendrain="normal" } ]
…API. The functions: fn {clear,detected,disable,enable}_{rising,falling,status}(PintSlot) and fn read_pint_status(...) become fn pint_op(PintSlot, PintOp, PintCondition) This leaves a couple permutations not covered (enable/disable interrupt at the NVIC level). Those can are left as no-ops for the time being. Future: The unimplemented combinations could return an error/fault if called.
Pressing the USER button generates an interrupt to the button task. A single press will increment the RGB pattern. Quick (~1.5s) successive presses 2nd, 3rd, and subsequent will respecitvely - turn off LEDs - blink LEDs - cycle through RBG pattern including all off. Minor updates to other app.toml files: - add `pint` and `inputmux` peripherals to their `gpio_driver` tasks. - when compiling all targets, some needed slight allocation adjustments not related to this PR. Future: The unimplemented combinations could return an error/fault if called.
Pressing the USER button generates an interrupt to the button task.
A single press will increment the RGB pattern.
Quick (~1.5s) successive presses 2nd, 3rd, and subsequent will respecitvely
Minor updates to other app.toml files:
pint
andinputmux
peripherals to theirgpio_driver
tasks.